<?php
/**
 * Created by PhpStorm.
 * User: 仙女大人
 * Date: 2019/5/31
 * Time: 16:10
 */

namespace app\admin\model;
use think\Model;
use think\Db;

class Jquery extends Model
{
    // 关闭自动写入时间戳
    protected $autoWriteTimestamp = true;

    // 定义时间戳字段名
    // 默认的字段为create_time 和 update_time
    protected $updateTime = 'update_time';
    protected $createTime = 'create_time';



    public function region($region){
        // $region = input("post.code");
        $query = Db::name('jquery')->alias('x');
        $query->field("x.id,x.nickname,x.username,x.age,x.sex,x.create_time,x.update_time,e.region_name");
        $join = [
            ['city e','x.uid = e.region_id','LEFT'],
        ];
        $name = $query->join($join)->where(["x.uid"=>$region])->select();
        return $name;
        // halt($name);
    }

}